
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>提醒</title>
  <link
      href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css"
      rel="stylesheet"
    />
  <style>
    .h-50{
      height: 50px;
    }
  </style>
</head>
<body>
  <div class="container">
    <div class="h-50"></div>
    <div class="alert alert-success" role="alert">
      <h1>:) <%= msg %></h1>
      <p><span><%= time %></span> 秒后自动跳转<a href="<%= url %>">点击跳转</a></p>
    </div>
  </div>
  <script>
    let span = document.querySelector('span');
    let time = span.innerHTML;
    let timer = setInterval(() => {
      time--;
      //设置页面秒数的值
      span.innerHTML = time;
      //判断
      if(time === 0){
        //清空定时器
        clearInterval(timer);
        //跳转
        location.href = '<%= url %>'
      }
    }, 1000);
  </script>
</body>
</html>